﻿using System;
using Aluetjen.EmailService.Domain.Gateways;
using StructureMap.Configuration.DSL;

namespace Aluetjen.EmailService.Infrastructure.Registries
{
    public class GatewayRegistry : Registry
    {
        public GatewayRegistry()
        {
            For<IGatewayImpl>().Use<FileShareGateway>().Named(typeof(FileShareGateway).Name).Ctor<string>("fileShare").Is("C:\\temp");
            For<IGatewayImpl>().Use<SmtpGateway>().Named(typeof(SmtpGateway).Name);
            For<IGatewayImpl>().Use<Log4NetGateway>().Named(typeof(Log4NetGateway).Name);

            For<Func<string, IGatewayImpl>>().Use(ctx => name => ctx.GetInstance<IGatewayImpl>(name));
        }
    }
}